import { getPageLinkBtnData } from '@/api/syssetting/menu'

const cache = new Map<string, any>()

export const useLinkBtnCache = () => {
  const getCachedData = async (pagePath: string) => {
    if (cache.has(pagePath)) {
      return cache.get(pagePath)
    }
    
    const res = await getPageLinkBtnData({ PagePath: pagePath })
    cache.set(pagePath, res.data.Data)
    return res.data.Data
  }

  return {
    getCachedData
  }
}
